From 82cbe6cc410d589682db3197c185e8f0d4c08eec Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Thu, 16 Sep 2004 08:46:44 +0000 Subject: [PATCH] bitkeeper revision 1.1159.76.8 (414952f4XmpfTwUZczAePp3RY8piQQ) A few network cleanups (but this fixes no bugs). --- .../drivers/xen/netback/netback.c | 14 +++++--------- .../drivers/xen/netfront/netfront.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c index 103bcbd72f..d59ff8ef22 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c @@ -108,10 +108,6 @@ static inline void maybe_schedule_tx_action(void) tasklet_schedule(&net_tx_tasklet); } -/* - * This is the primary RECEIVE function for a network interface. - * Note that, from the p.o.v. of /this/ OS it looks like a transmit. - */ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev) { netif_t *netif = (netif_t *)dev->priv; @@ -156,7 +152,7 @@ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev) return 0; drop: - netif->stats.rx_dropped++; + netif->stats.tx_dropped++; dev_kfree_skb(skb); return 0; } @@ -260,8 +256,8 @@ static void net_rx_action(unsigned long unused) skb_shinfo(skb)->nr_frags = 0; skb_shinfo(skb)->frag_list = NULL; - netif->stats.rx_bytes += size; - netif->stats.rx_packets++; + netif->stats.tx_bytes += size; + netif->stats.tx_packets++; /* The update_va_mapping() must not fail. */ if ( unlikely(mcl[0].args[5] != 0) ) @@ -579,8 +575,8 @@ static void net_tx_action(unsigned long unused) skb->dev = netif->dev; skb->protocol = eth_type_trans(skb, skb->dev); - netif->stats.tx_bytes += txreq.size; - netif->stats.tx_packets++; + netif->stats.rx_bytes += txreq.size; + netif->stats.rx_packets++; netif_rx(skb); netif->dev->last_rx = jiffies; diff --git a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c index 1c06463e95..9501c26978 100644 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c @@ -358,7 +358,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev) { printk(KERN_ALERT "%s: full queue wasn't stopped!\n", dev->name); netif_stop_queue(dev); - return -ENOBUFS; + goto drop; } if ( unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >= @@ -366,7 +366,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct sk_buff *new_skb; if ( unlikely((new_skb = alloc_skb_page()) == NULL) ) - return 1; + goto drop; skb_put(new_skb, skb->len); memcpy(new_skb->data, skb->data, skb->len); dev_kfree_skb(skb); @@ -378,7 +378,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev) if ( np->backend_state != BEST_CONNECTED ) { spin_unlock_irq(&np->tx_lock); - return 1; + goto drop; } i = np->tx->req_prod; @@ -414,6 +414,11 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev) notify_via_evtchn(np->evtchn); return 0; + + drop: + np->stats.tx_dropped++; + dev_kfree_skb(skb); + return 0; } -- 2.30.2